package uk.co.javahelp.sender.message.csv;

import java.util.HashMap;
import java.util.Map;

import uk.co.javahelp.sender.message.Attachment;
import uk.co.javahelp.sender.message.MessageFactoryFactory;

public class CsvMessageFactoryFactory implements MessageFactoryFactory<String[]> {
	
	@Override
	public CsvMessageFactory createMessageFactory(final String template, final String[] headers, final Attachment... attachments) {
		final Map<String, Integer> columns = new HashMap<String, Integer>(headers.length);
		for(int i = 0 ; i < headers.length ; i++) {
			columns.put(headers[i], i);
		}
		return new CsvMessageFactory(template, columns, attachments);
	}
}
